package cn.aixuegao.web.admin;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import cn.aixuegao.common.base.controller.BaseController;
import cn.aixuegao.model.admin.Column;
import cn.aixuegao.model.user.User;
import cn.aixuegao.service.admin.ColumnService;

@Controller
@RequestMapping(value="/admin")
public class IndexController extends BaseController{

	@Autowired
	ColumnService columnService;
	
	@RequestMapping(value={"/index","/"},method=RequestMethod.GET)
	public String index(Model map) {
		//User user = getUser(); 做好登陆后再放开，才会有session
		User user = new User();
		user.setId(1);
		List<Column> columnTree = columnService.getColumnTree(user);
		
		map.addAttribute("columnTree", columnTree);
		return "admin/index";
	}
	
	@RequestMapping(value="/article",method=RequestMethod.GET)
	public String article() {
		return "admin/article";
	}
	
	/*@RequestMapping(value="/blog",method=RequestMethod.GET)
	public String blog() {
		return "admin/blog";
	}*/
	
	@RequestMapping(value="/graph_echarts",method=RequestMethod.GET)
	public String graph_echarts() {
		return "admin/graph_echarts";
	}
	
	@RequestMapping(value="/index_v1",method=RequestMethod.GET)
	public String index_v1() {
		return "admin/index_v1";
	}
	
	@RequestMapping(value="/table_bootstrap",method=RequestMethod.GET)
	public String table_bootstrap() {
		return "admin/table_bootstrap";
	}
}
